/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ori
 */
@Entity
@Table(name = "GameLevel")
@NamedQueries({
    @NamedQuery(name = "GameLevel.findAll", query = "SELECT g FROM GameLevel g"),
    @NamedQuery(name = "GameLevel.findByLevelNo", query = "SELECT g FROM GameLevel g WHERE g.levelNo = :levelNo"),
    @NamedQuery(name = "GameLevel.findByStartMoney", query = "SELECT g FROM GameLevel g WHERE g.startMoney = :startMoney")})
public class GameLevel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "levelNo")
    private Integer levelNo;
    @Basic(optional = false)
    @Column(name = "startMoney")
    private double startMoney;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "gameLevel")
    private Collection<Clue> clueCollection;
    @JoinColumn(name = "waypoint1", referencedColumnName = "waypointid")
    @ManyToOne(optional = false)
    private Waypoint waypoint1;
    @JoinColumn(name = "waypoint2", referencedColumnName = "waypointid")
    @ManyToOne(optional = false)
    private Waypoint waypoint2;

    public GameLevel() {
    }

    public GameLevel(Integer levelNo) {
        this.levelNo = levelNo;
    }

    public GameLevel(Integer levelNo, double startMoney) {
        this.levelNo = levelNo;
        this.startMoney = startMoney;
    }

    public Integer getLevelNo() {
        return levelNo;
    }

    public void setLevelNo(Integer levelNo) {
        this.levelNo = levelNo;
    }

    public double getStartMoney() {
        return startMoney;
    }

    public void setStartMoney(double startMoney) {
        this.startMoney = startMoney;
    }

    public Collection<Clue> getClueCollection() {
        return clueCollection;
    }

    public void setClueCollection(Collection<Clue> clueCollection) {
        this.clueCollection = clueCollection;
    }

    public Waypoint getWaypoint1() {
        return waypoint1;
    }

    public void setWaypoint1(Waypoint waypoint1) {
        this.waypoint1 = waypoint1;
    }

    public Waypoint getWaypoint2() {
        return waypoint2;
    }

    public void setWaypoint2(Waypoint waypoint2) {
        this.waypoint2 = waypoint2;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (levelNo != null ? levelNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GameLevel)) {
            return false;
        }
        GameLevel other = (GameLevel) object;
        if ((this.levelNo == null && other.levelNo != null) || (this.levelNo != null && !this.levelNo.equals(other.levelNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.GameLevel[levelNo=" + levelNo + "]";
    }

}
